<#include "${ftl_skin}/common/header.ftl">


</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">标签管理</div>
        <div class="ibox-content">



            <!--搜索栏-->

            <form id="bs-form" role="form" class="form-inline">
                <div class="form-group">
                    <label for="tag_title" class="control-label">标签名 : </label>
                    <input type="text" placeholder="请输入标签名" name="tag_title" id="tag_title" class="form-control">
                </div>

                <button class="btn btn-primary" type="button" onclick="searchBSTable('bs-table', 'bs-form');return false;">搜索</button>
            </form>
            <!--/搜索栏-->

            <!--列表-->

            <!--工具栏-->
            <div id="bs-toolbar" class="btn-group">
                <button type="button" class="btn btn-outline btn-default" onclick="item_add();return false;">
                    <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                </button>

                <!--
                <button type="button" class="btn btn-outline btn-default">
                    <i class="glyphicon glyphicon-heart" aria-hidden="true"></i>
                </button>
                -->
                <button type="button" class="btn btn-outline btn-default" onclick="item_del(getIdSelections('bs-table').toString());return false;">
                    <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
                </button>

            </div>
            <!--/工具栏-->

            <table 	id="bs-table"
                      data-url="${path.servicePath}tags/tagslist.do?tag_type=${tag_type!}"
                      data-method="post"
                      data-response-handler="pagerTableResponseHandler"
                      data-pagination="true"
                      data-page-list="[10, 20, 50, 100]"

                      data-toolbar="#bs-toolbar"
                      data-resizable="true"

                      data-side-pagination="server"
                      data-content-type="application/x-www-form-urlencoded;charset=utf-8"

                      data-click-to-select="true"
                      data-single-select="true"

                      data-classes="table table-hover table-condensed"
                      data-striped="true"

                      data-height="500">
                <thead>
                <tr>
                    <th data-formatter="operateFormatter" data-width="50" data-align="center"></th>
                    <th data-field="tableid" data-checkbox="true"></th>
                    <th data-field="tag_title" data-align="center" data-sortable="true">标签名称</th>
                    <th data-field="tag_desc" data-align="center" data-sortable="true">标签描述</th>


                </tr>
                </thead>
            </table>

            <!--/列表-->



        </div><!-- end ibox-content -->
    </div><!-- end ibox -->
</div><!-- end wrap -->



<#include "${ftl_skin}/common/js.ftl">


<script type="text/javascript">
    $(function(){

        initBSTable('bs-table', {});

        // openDialog('item_edit', '客户信息', 'http://www.hong-feng.com', '', 650, 300, dialogCallback);


        // HFToastr("标题", "哈哈");
        // HFConfirm("哈哈", "", "", function(isConfirm){
        // 	HFAlert('adf' + isConfirm);
        // });
    });

    //格式化显示
    function operateFormatter(value, row, index) {
        return [
            '<a class="remove" href="javascript:item_del(\'' + row.tableid + '\');" title="remove">',
            '<i class="glyphicon glyphicon-remove"></i>',
            '</a>&nbsp;',
            '&nbsp;<a class="edit" href="javascript:item_edit(\'' + row.tableid + '\');" title="edit">',
            '<i class="glyphicon glyphicon-edit"></i>',
            '</a>'
        ].join('');
    }

    function item_add(){

        openDialog('item_edit', '标签信息', '${path.viewPath }tags/tagsedit.do?tag_type=${tag_type!}', '', 650, 300, function(){
            var returnVal = this.returnValue;
            if(returnVal == 'reload'){
                refreshBSTable('bs-table');
            }
            return false;
        });

        // alert('新增');
    }
    function item_del(itemid){


        // var ids = getIdSelections('bs-table');
        // if(ids == ''){
        // 	HFAlert("请先选择需要操作的数据！", "", "warning");
        // 	return;
        // }

        HFConfirm("确认要删除选中该信息吗？", "", "warning", function(isConfirm){
            if(isConfirm){
                HFAjax("${path.servicePath }tags/tagsdel.do", {itemid: itemid}, function(result){
                    HFToastrTipResult(result);
                    refreshBSTable('bs-table');
                });
            }
        });

        // alert('删除' + itemid);
    }
    function item_edit(itemid){

        openDialog('item_edit', '标签信息', '${path.viewPath }tags/tagsedit.do?itemid=' + itemid, '', 650, 300, function(){
            var returnVal = this.returnValue;
            if(returnVal == 'reload'){
                refreshBSTable('bs-table');
            }
            return false;
        });

        // alert('编辑' + itemid);
    }



</script>

<#include "${ftl_skin}/common/footer.ftl">